

from base.base import Base
from selenium.webdriver.common.by import By
from time import sleep
import logging


class PingLunPage(Base):

    guanzhutag = (By.XPATH,'/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.RelativeLayout/android.widget.LinearLayout/android.widget.RelativeLayout[1]/android.widget.LinearLayout/android.widget.TextView')
    pinglunanniu = (By.XPATH,'/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.FrameLayout/android.widget.FrameLayout[2]/android.view.ViewGroup/android.view.ViewGroup/androidx.viewpager.widget.ViewPager/androidx.recyclerview.widget.RecyclerView/android.widget.FrameLayout/android.widget.FrameLayout/android.view.ViewGroup/android.view.ViewGroup/androidx.recyclerview.widget.RecyclerView/android.widget.FrameLayout[3]/android.view.ViewGroup/android.widget.LinearLayout[2]/android.widget.LinearLayout[2]/android.widget.TextView[1]')
    fabiaopinglun = (By.ID,'com.kongfz.app:id/tv_input')
    shurukuang = (By.ID,'com.kongfz.app:id/et_input')
    fabuanniu = (By.ID,'com.kongfz.app:id/tv_publish')

    dy = (By.XPATH,'/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.view.ViewGroup/androidx.recyclerview.widget.RecyclerView/android.widget.FrameLayout[3]/android.view.ViewGroup/android.widget.TextView[1]')

    def pinglunyewu(self,content):

        logging.info("首页，点击关注tag")
        self.loc_ele(self.guanzhutag).click()
        sleep(2)
        self.driver.swipe(425,1319,425,743,500)
        sleep(2)
        self.loc_ele(self.pinglunanniu).click()
        sleep(2)
        self.loc_wait_ele(self.fabiaopinglun).click()
        sleep(2)
        self.loc_ele(self.shurukuang).send_keys(content)
        sleep(2)
        self.loc_wait_ele(self.fabuanniu).click()
        sleep(2)
